/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.vienthonga.hibernate.dao;

import com.vienthonga.hibernate.pojo.TSupplier;
import com.vienthonga.hibernate.utils.HibernateUtil;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author DoanHa
 */
public class SupplierDAO {

    public static List<TSupplier> getAllSupplier()
    {
        List<TSupplier> suppliers = new ArrayList<TSupplier>();
        Session session = HibernateUtil.getSessionFactory().openSession();
        try
        {
             // lay thong tin nha san xuat
            String hqlQuery = "from TSupplier ";

            Query query = session.createQuery(hqlQuery);
            suppliers = query.list();
            return suppliers;
        }
        catch(Exception ex)
        {
            System.out.println(ex.getMessage());
            return null;
        }
       
    }
}
